package thread;

import java.util.concurrent.TimeUnit;

public class ThreadTest1 {

    public static void main(String[] args) throws InterruptedException {
        Runnable worker1 = () -> {
            try {
                System.out.println("洗水壶");
                TimeUnit.SECONDS.sleep(1);

                
                System.out.println("洗茶杯");
                TimeUnit.SECONDS.sleep(1);

                TimeUnit.SECONDS.sleep(1);
                System.out.println("拿茶叶");

            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        };

        Runnable worker2 = () -> {
            try {
                System.out.println("烧开水");
                TimeUnit.SECONDS.sleep(5);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        };

        Thread thread1 = new Thread(worker1);
        Thread thread2 = new Thread(worker2);

        thread1.start();
        thread2.start();

        thread1.join();
        thread2.join();

        System.out.println("泡茶");
    }
    
}
